﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/List2.Master" AutoEventWireup="true" CodeBehind="ProjectFileCabinet_List.aspx.cs" Inherits="Honestysoft.Financing.WebUI.Module.Attach.ProjectFileCabinet_List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
        function openwindow(url, name) {
            var iWidth = 940; //弹出窗口的宽度;
            var iHeight = window.screen.availHeight - 30; //弹出窗口的高度;
            var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
            var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
            window.open(url, name, 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=yes,resizeable=no,location=no,status=no');
        }
        function dataItem() {
            var ID;
            var Val;
        }
        var DataItemArray = new Array();
        function setNewItem(id) {
            var isExists = false;
            if (DataItemArray.length > 0) {
                for (var i = 0; i < DataItemArray.length; i++) {
                    if (DataItemArray[i].ID == id) {
                        isExists = true;
                        break;
                    }
                }
            }
            if (!isExists) {
                var newItem = new dataItem();
                newItem.ID = id;
                newItem.Val = "";
                DataItemArray.push(newItem);
            }
        }
        function setValue(id, cabNo) {
            setNewItem(id);
            for (var i = 0; i < DataItemArray.length; i++) {
                if (DataItemArray[i].ID == id) {
                    DataItemArray[i].Val = cabNo;
                    break;
                }
            }
        }
        function save() {
            if (DataItemArray.length == 0) {
                alert("没有需要保存的数据！");
                return;
            }
            var res = "";
            for (var i = 0; i < DataItemArray.length; i++) {
                if (res != "") {
                    res += "$";
                }
                res += DataItemArray[i].ID + "|" + DataItemArray[i].Val;
            }
            $.ajax({
                type: 'POST',
                url: "Json/SaveCabinet.ashx",
                data: { "Data": res },
                success: function (msg) {
                    if (unescape(msg) != "0") {
                        alert(unescape(msg));
                    }
                    else {
                        alert('保存成功！');
                    }
                }
            });
        }
        function Print() {
            var category = $('#<%=ddlProjectCategory.ClientID %>').val();
            var sn = escape($('#<%=txtSN.ClientID %>').val());
            var name = escape($('#<%=txtName.ClientID %>').val());
            window.open('<%=System.Configuration.ConfigurationManager.AppSettings["ReportServerURL"] %>/R014&Category='+category+'&SN='+sn+'&Name='+name+'&rc:parameters=false');
        }
        function openUpload() {
            openDialog('<%=Honestysoft.Baseframework.WebUI.Globals.Home %>Module/Attach/MutilFileUpload.aspx', 500, 400, "批量上传合同相关文件");
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <div class="query_area">
        项目单位：<asp:DropDownList ID="ddlProjectCategory" runat="server" cssClass="input2" ></asp:DropDownList>&nbsp;&nbsp;
		编号：<asp:TextBox ID="txtSN" runat="server"  cssClass="input2" MaxLength="200" Width="80px"></asp:TextBox>&nbsp;&nbsp;		
		项目名称：<asp:TextBox ID="txtName" runat="server"  cssClass="input2" MaxLength="200" Width="150px"></asp:TextBox>&nbsp;&nbsp;
        <asp:Button runat="server" ID="btnQuery" Text="查 找" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'" onclick="btnQuery_Click"/>&nbsp;&nbsp;
        <asp:Button runat="server" ID="btnSave" Text="保 存" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'"  OnClientClick="save();return false;" />
        <asp:Button runat="server" ID="btnPrint" Text="打 印" CssClass="btn_normal" 
			onMouseOver="this.className='btn_active'" 
            onMouseOut="this.className='btn_normal'"  OnClientClick="Print();return false;" />
        <asp:Button runat="server" ID="Button1" Text="批量上传文件" CssClass="btn_big_normal" 
			onMouseOver="this.className='btn_big_active'" 
            onMouseOut="this.className='btn_big_normal'"  OnClientClick="openUpload();return false;" />
    </div>
     <table cellpadding="0" width="100%" cellspacing="0" border="1" class="t1" id="tGrid">
		<thead>  
            <th align="center" width="120px">项目单位</th>
            <th align="center" width="50px">项目编号</th>
            <th align="center">项目名称</th>
            <th align="center" width="120px">文件柜号<br /><span style="color:Red">(多个时用","隔开)</span></th>
      	</thead>           
		<asp:Repeater runat="server" ID="rptList" 
             onitemdatabound="rptList_ItemDataBound">
			<ItemTemplate>
				<tr>
                    <td><%#  DataBinder.Eval(Container.DataItem, "Owner971Name")%></td>
					<td><%#  DataBinder.Eval(Container.DataItem,"SN") %></td>
                    <td style="text-align:left">
                    <%#  DataBinder.Eval(Container.DataItem,"Name") %>						
                    </td>
                    <td><asp:TextBox runat="server" ID="txtCabinetNo" cssClass="input2" Width="108px"></asp:TextBox></td>
				</tr>  
			</ItemTemplate>
		</asp:Repeater>
    </table>
    <div  class="paging_area" >
    <frameworkwebcontrols:aspnetpager id="AspNetPager1" runat="server"
                    alwaysshow="true" firstpagetext="首页" lastpagetext="尾页" nextpagetext="下一页" pageindexboxtype="DropDownList"
                    prevpagetext="上一页" showpageindex="true" showcustominfosection="Right" submitbuttontext="Go"
                    textafterpageindexbox="页" textbeforepageindexbox="转到" currentpagebuttonposition="End"
                    layouttype="Div" custominfotextalign="Right" custominfohtml="共%RecordCount%条记录。第%CurrentPageIndex%页，共%PageCount%页，每页%PageSize%条"
                    direction="LeftToRight" onpagechanged="AspNetPager1_PageChanged">
                </frameworkwebcontrols:aspnetpager>            
    </div>
</asp:Content>
